import 'package:boss/models/offers.dart';
import 'package:boss/ui/page/offersManagement/offers_management_page.dart';
import 'package:boss/ui/page/offersManagement/page/plusOffersMode/page/doubleOffers/provider/double_offers_provider.dart';
import 'package:boss/ui/widget/alert/alert.dart';
import 'package:boss/ui/widget/back_confirmation.dart';
import 'package:boss/ui/widget/center_title_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:router/annotation.dart';

import 'widget/double_offers_browser.dart';

@RouterConfig(DoubleOffersPage.pageName)
class DoubleOffersPage extends StatefulWidget {
  static const pageName = '/doubleOffersPage';

  @Autowired()
  final Offers data;

  const DoubleOffersPage({this.data});

  @override
  _DoubleOffersPageState createState() => _DoubleOffersPageState();
}

class _DoubleOffersPageState extends State<DoubleOffersPage> {
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (context) => DoubleOffersProvider(data: widget.data),
      child: BackConfirmation(
        backConfirmationText: '优惠还未完成确认返回么？',
        child: Scaffold(
          appBar: CenterTitleAppBar(
            title: '创建优惠',
            backConfirmationText: '优惠还未完成确认返回么？',
          ),
          body: DoubleOffersBrowser(),
        ),
      ),
    );
  }
}
